import request from '@/utils/request'

export const getSpuListApi = (currentPage, pageSize, id) => {
  return request({
    url: `/admin/product/${currentPage}/${pageSize}?category3Id=${id}`,
    method: 'get'
  })
}

export const deleteSpuInfoApi = (spuId) => {
  return request({
    url: `/admin/product/deleteSpu/${spuId}`,
    method: 'delete'
  })
}

// spu addorupdate
export const getTrademarkListApi = () => {
  return request({
    url: '/admin/product/baseTrademark/getTrademarkList',
    method: 'get'
  })
}

export const getBaseSaleAttrListApi = () => {
  return request({
    url: '/admin/product/baseSaleAttrList',
    method: 'get'
  })
}

export const SaveSpuInfoApi = (Info) => {
  return request({
    url: `/admin/product/saveSpuInfo`,
    method: 'post',
    data: Info
  })
}
export const UpdateSpuInfoApi = (Info) => {
  return request({
    url: `/admin/product/updateSpuInfo`,
    method: 'post',
    data: Info
  })
}

export const getEditSpuImageListApi = (id) => {
  return request({
    url: `/admin/product/spuImageList/${id}`,
    method: 'get'
  })
}
export const getEditSpuSaleAttrListApi = (id) => {
  return request({
    url: `/admin/product/spuSaleAttrList/${id}`,
    method: 'get'
  })
}

//sku add
export const getAttrInfoListApi = (category1Id, category2Id, category3Id) => {
  return request({
    url: `/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`,
    method: 'get'
  })
}

export const SaveSkuInfoApi = (obj) => {
  return request({
    url: '/admin/product/saveSkuInfo',
    method: 'post',
    data: obj
  })
}
